package com.js.basic.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.js.basic.mapper.CodeRulesMapper;
import com.js.basic.domain.CodeRules;
import com.js.basic.service.ICodeRulesService;

/**
 * 编码规则Service业务层处理
 * 
 * @author lzq
 * @date 2024-06-14
 */
@Service
public class CodeRulesServiceImpl implements ICodeRulesService 
{
    @Autowired
    private CodeRulesMapper codeRulesMapper;

    /**
     * 查询编码规则
     * 
     * @param encoId 编码规则主键
     * @return 编码规则
     */
    @Override
    public CodeRules selectCodeRulesByEncoId(Long encoId)
    {
        return codeRulesMapper.selectCodeRulesByEncoId(encoId);
    }

    /**
     * 查询编码规则列表
     * 
     * @param codeRules 编码规则
     * @return 编码规则
     */
    @Override
    public List<CodeRules> selectCodeRulesList(CodeRules codeRules)
    {
        return codeRulesMapper.selectCodeRulesList(codeRules);
    }

    /**
     * 新增编码规则
     * 
     * @param codeRules 编码规则
     * @return 结果
     */
    @Override
    public int insertCodeRules(CodeRules codeRules)
    {
        codeRules.setCreateTime(DateUtils.getNowDate());
        return codeRulesMapper.insertCodeRules(codeRules);
    }

    /**
     * 修改编码规则
     * 
     * @param codeRules 编码规则
     * @return 结果
     */
    @Override
    public int updateCodeRules(CodeRules codeRules)
    {
        return codeRulesMapper.updateCodeRules(codeRules);
    }

    /**
     * 批量删除编码规则
     * 
     * @param encoIds 需要删除的编码规则主键
     * @return 结果
     */
    @Override
    public int deleteCodeRulesByEncoIds(Long[] encoIds)
    {
        return codeRulesMapper.deleteCodeRulesByEncoIds(encoIds);
    }

    /**
     * 删除编码规则信息
     * 
     * @param encoId 编码规则主键
     * @return 结果
     */
    @Override
    public int deleteCodeRulesByEncoId(Long encoId)
    {
        return codeRulesMapper.deleteCodeRulesByEncoId(encoId);
    }

    @Override
    public CodeRules selectCodeRulesByTableName(String tableExplain) {
        return codeRulesMapper.selectCodeRulesByTableName(tableExplain);
    }

    @Override
    public int updateCodeNowByTableName(CodeRules codeRules) {
        return codeRulesMapper.updateCodeNowByTableName(codeRules);
    }
}
